package thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: tao
 * Date: 2023-11-24
 * Time: 12:18
 */
public class ThreadDemo3 {
    private static int count = 0;
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            for (int i = 0; i < 5000; i++) {
                count++;
            }
            System.out.println("count: " + count);
        });
        //t线程开始前
        System.out.println("t线程开始前: " + t.getState());

        t.start();
        //t线程执行中
        System.out.println("t线程执行中: " + t.getState());

        //t线程结束后
        t.join();
        System.out.println("t线程结束后: " + t.getState());
    }
}
